home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / portable / wdelch.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.8 KB  |  76 lines

  1. #ifndef NO_MEMORY_H
  2. #include <memory.h>
  3. #endif
  4. #define    CURSES_LIBRARY    1
  5. #include <curses.h>
  6. #undef    wdelch
  7.  
  8. #ifdef PDCDEBUG
  9. char *rcsid_wdelch = "$Header: C:\CURSES\portable\RCS\wdelch.c 2.1 1993/06/18 20:21:38 MH Rel MH $";
  10. #endif
  11.  
  12.  
  13.  
  14.  
  15. /*man-start*********************************************************************
  16.  
  17.   wdelch()    - remove character from window
  18.  
  19.   X/Open Description:
  20.      The character under the cursor in the window is deleted.  All
  21.      characters to the right on the same line are moved to the left
  22.      one position and the last character on the line is filled with
  23.      a blank.  The cursor position does not change (after moving to
  24.      y, x if coordinates are specified).
  25.  
  26.      NOTE: delch(), mvdelch(), and mvwdelch() are macros.
  27.  
  28.   PDCurses Description:
  29.      Nothing additional.
  30.  
  31.   X/Open Return Value:
  32.      The wdelch() function returns OK on success and ERR on error.
  33.  
  34.   X/Open Errors:
  35.      No errors are defined for this function.
  36.  
  37.   Portability:
  38.      PDCurses    int wdelch( WINDOW* win );
  39.      X/Open Dec '88    int wdelch( WINDOW* win );
  40.      BSD Curses    int wdelch( WINDOW* win );
  41.      SYS V Curses    int wdelch( WINDOW* win );
  42.  
  43. **man-end**********************************************************************/
  44.  
  45. int    wdelch(WINDOW *win)
  46. {
  47.     int        y;
  48.     int        x;
  49.     int        maxx;
  50.     chtype*        temp1;
  51.  
  52. #ifdef PDCDEBUG
  53.     if (trace_on) PDC_debug("wdelch() - called\n");
  54. #endif
  55.  
  56.     if (win == (WINDOW *)NULL)
  57.         return (ERR);
  58.  
  59.     y    = win->_cury;
  60.     x    = win->_curx;
  61.     maxx    = win->_maxx - 1;
  62.     temp1    = &win->_y[y][x];
  63.  
  64.     memmove( temp1, temp1 + 1, (maxx - x) * sizeof(chtype) );
  65.  
  66.     win->_y[y][maxx] = win->_blank | win->_attrs;
  67.     win->_lastch[y] = maxx;
  68.  
  69.     if ((win->_firstch[y] == _NO_CHANGE) ||
  70.         (win->_firstch[y] > x))
  71.     {
  72.         win->_firstch[y] = x;
  73.     }
  74.     return (OK);
  75. }
  76.